/*
Kakine
ActionScript Framework
Copyright © 2011, PUNY, LLC.

This file is part of KAKINE.

KAKINE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

KAKINE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with KAKINE.  If not, see <http://www.gnu.org/licenses/>.
*/ 
package com.puny.mvc.controllers.keyscanner
{
	import flash.events.Event;
	
	internal class KeyScanner
	{
		private var _scanner:KeyController;
		private var _eventDown:Event;
		private var _eventUp:Event;
		private var _checker:Boolean = false;
		public function KeyScanner(scanner:KeyController,type:String)
		{
			_scanner = scanner;
			_eventDown = new Event(type+KeyController.DOWN);
			_eventUp = new Event(type+KeyController.UP);
		}
		
		protected function dispatchDownEvent():void {
			_scanner.dispatchEvent(_eventDown.clone());
		}
		
		protected function dispatchUpEvent():void {
			_scanner.dispatchEvent(_eventUp.clone());
		}
		
		protected function get checker():Boolean {
			return _checker;
		}
		
		protected function set checker(value:Boolean):void {
			_checker = value;
		}
	}
}